package com.ruoyi.web.controller.goods;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.goods.domain.GoodsType;
import com.ruoyi.goods.service.GoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//商品类型
@RestController
@RequestMapping("/goodsType")
public class GoodsTypeController extends BaseController {

    @Autowired
    private GoodsTypeService goodsTypeService;

    @PostMapping("/queryByPage")
    public TableDataInfo queryByPage() {
        startPage();
        return getDataTable(goodsTypeService.queryByPage());
    }

    @RequestMapping("/getList")
    public TableDataInfo getList() {
        return getDataTable(goodsTypeService.getList());
    }

    @PostMapping("/insertGoodsType")
    public AjaxResult insertGoodsType(GoodsType goodsType) throws Exception {
        return success(goodsTypeService.insert(goodsType));
    }

    @PostMapping("/updateGoodsType")
    public AjaxResult updateGoodsType(GoodsType goodsType) {
        return success(goodsTypeService.update(goodsType));
    }

    @PostMapping("/delGoodsTypePersonByIds/{ids}")
    public AjaxResult delByIds(@PathVariable Long[] ids) {
        return success(goodsTypeService.delByIds(ids));
    }
}
